package huixue.cn.com.rxapp.rx;

import android.app.Activity;
import android.content.Intent;
import android.content.res.Configuration;
import android.os.PersistableBundle;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.MotionEvent;
import android.view.View;
import android.view.WindowManager;

import butterknife.BindView;
import huixue.cn.com.library.util.ToastUtils;
import huixue.cn.com.rxapp.R;
import huixue.cn.com.rxapp.ui.TestActivity;
import huixue.cn.com.rxapp.util.LogUtils;
import huixue.cn.com.rxapp.widget.MyView;
import huixue.cn.com.rxapp.widget.MyViewGroup;

public class HookActivity extends Activity {

    //@BindView(R.id.view1)
    MyView view1;

    MyViewGroup viewgroup1;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_hook);
        view1 = findViewById(R.id.view1);
        viewgroup1 = findViewById(R.id.viewgroup1);
        LogUtils.e("HookActivity","==onCreate==");
    }

    @Override
    public void onSaveInstanceState(Bundle outState, PersistableBundle outPersistentState) {
        super.onSaveInstanceState(outState, outPersistentState);
        LogUtils.e("HookActivity","==onSaveInstanceState==");
    }

    @Override
    protected void onStart() {
        super.onStart();
        LogUtils.e("HookActivity","==onStart==");
    }

    @Override
    protected void onRestart() {
        super.onRestart();
        LogUtils.e("HookActivity","==onRestart==");
    }

    @Override
    public void onWindowAttributesChanged(WindowManager.LayoutParams params) {
        super.onWindowAttributesChanged(params);
        LogUtils.e("HookActivity","==onWindowAttributesChanged==");
    }

    @Override
    protected void onResume() {
        super.onResume();
        LogUtils.e("HookActivity","==onResume==");
    }

    @Override
    public void onWindowFocusChanged(boolean hasFocus) {
        super.onWindowFocusChanged(hasFocus);
        LogUtils.e("HookActivity","==onResume==");
    }

    @Override
    protected void onPause() {
        super.onPause();
        LogUtils.e("HookActivity","==onPause==");
    }

    @Override
    protected void onStop() {
        super.onStop();
        LogUtils.e("HookActivity","==onStop==");
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        LogUtils.e("HookActivity","==onDestroy==");
    }

    @Override
    public void onAttachedToWindow() {
        super.onAttachedToWindow();
    }

    @Override
    public boolean dispatchTouchEvent(MotionEvent ev) {
         boolean flag = super.dispatchTouchEvent(ev);
         //LogUtils.e("HookActivity","flag=="+flag);
         return  false;
    }

    @Override
    public boolean onTouchEvent(MotionEvent event) {
        //LogUtils.e("HookActivity","==onTouchEvent=="+MotionEvent.actionToString(event.getAction()));

        return super.onTouchEvent(event);
        //return true;

    }

    public void actionClick(View view){
        //LogUtils.e("HookActivity","==actionClick==");

    }

    public void actionClick2(View view){
        //LogUtils.e("HookActivity","==actionClick2==");

        Intent intent = new Intent(this, TestActivity.class);
        startActivity(intent);

    }

    @Override
    public void onConfigurationChanged(Configuration newConfig) {
        super.onConfigurationChanged(newConfig);
        LogUtils.e("HookActivity","==onConfigurationChanged==");

    }
}
